package com.xujinchen.struct;

public class ForDemo02 {
    public static void main(String[] args) {
        //计算100以内奇数和偶数和
        int oddSum =0;
        int evenSum = 0;
        for (int i = 0; i <=100; i++) {
            if (i%2!=0){//奇数
                oddSum=oddSum+i;
            }else {//偶数
                evenSum=evenSum+i;
            }

        }
        System.out.println("奇数和"+oddSum);
        System.out.println("偶数和"+evenSum);
    }
}
